//
//  ZCCommentDetailsCell.m
//  zctx
//
//  Created by apple on 15/12/30.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCCommentDetailsCell.h"

@implementation ZCCommentDetailsCell

- (void)awakeFromNib {
    // Initialization code
    self.lineHeight.constant = 0.5;
    self.nameLable.textColor = [UIColor colorWithHexString:@"#8a8a8a"];
    self.timeLable.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
    self.contentLable.textColor = [UIColor colorWithHexString:@"#404040"];
    self.lineView.backgroundColor = RGB(236, 237, 238);
}

-(void)setIndex:(NSIndexPath *)index{
    _index = index;
    if (index.section ==0) {
        self.weight.constant = 18;
    }else{
        self.weight.constant = 18+45;
    }
}

-(void)setModel:(ZCInvolvedDetailsModelHotComments *)model{
    _model = model;
    self.nameLable.text = model.username;
    int timeInt =[model.ctime intValue];
    self.timeLable.text = [NSString stringWithFormat:@"%@",stringDataWithTimeInterval(timeInt)];
    self.contentLable.text = model.content;
    
    if (model.avatar.length>0) {
        [self.iconImgView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"projectdetail_icon"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
            
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                UIImage *images = [UIImage circleImage:image withParam:0];
                dispatch_async(dispatch_get_main_queue(), ^{
                    self.iconImgView.image = images;
                    
                });
            });
        }];
    }else{
        self.iconImgView.image = [UIImage imageNamed:@"projectdetail_icon"];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
